export default {
  data () {
    return {
      rangeTime: [],
      isPassOneYear: false,
      timeOption: ['0', '7', '30'],
      timeParentKey: 'params',
      beginTimeKey: 'startTime',
      endTimeKey: 'endTime'
    }
  },
  methods: {
    onRangeChange (
      val,
      timeParentKey = this.timeParentKey,
      startTime = this.beginTimeKey,
      endTime = this.endTimeKey
    ) {
      this[timeParentKey][startTime] =
        (val && val.length && val[0] + ' 00:00:00') || null
      this[timeParentKey][endTime] =
        (val && val.length && val[1] + ' 23:59:59') || null
    },
    onDatePickerChange (val) {
      this.onRangeChange(val)
      if (typeof this.pickerChangeLoad === 'function') this.pickerChangeLoad()
    }
  }
}
